home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / turlvi23.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  2.5 KB  |  92 lines

  1. //    Copyright (c) 1994, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TURLView
  4. //    Include File:    turlview.h
  5. //    Purpose:    Provide a view for a URL
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        02-24-94    created
  9. #define Uses_TInputLine
  10. #define Uses_TLabel
  11. #define Uses_THistory
  12. #define Uses_TProgram
  13. #define Uses_TDeskTop
  14. #define Uses_TDialog
  15. #define Uses_TButton
  16. #include"turlview.h"
  17. #include"trace.h"
  18. #include"globals.h"
  19.  
  20. void TURLView::print()    {
  21. //    Purpose:    Print a rendered view image.
  22. //    Arguments:    void
  23. //    Return Value:    void
  24. //    Remarks/Portability/Dependencies/Restrictions:
  25. //        Function does a little dos trick by saving to the requested
  26. //        dos device like LPT1, LPT2, COM1, etc....
  27. //    Revision History:
  28. //        03-24-94    created
  29.  
  30. #ifndef RELEASE
  31.     trace("printing rendered");
  32. #endif // RELEASE
  33.     //    General use rectangle.
  34.     auto TRect TR(0, 0, 50, 7);
  35.  
  36.     //    Create a dialog that asks for which dos device to print on.
  37.     TDialog *TDp_print = new TDialog(TR, "Print Rendering");
  38.     if(TDp_print == NULL)    {
  39.         doslynxmessage("Unable to create print dialog.");
  40.         return;
  41.     }
  42.  
  43.     //    Set some dialog options.
  44.     TDp_print->options |= ofCentered;
  45.  
  46.     //      Make the input line to enter the dos device to print to.
  47.     TR = TRect(6, 2, 44, 3);
  48.     TInputLine *TILp_dosDevice = new TInputLine(TR, usi_TILURLSize - 1);
  49.     TILp_dosDevice->setData(cp_Printer);
  50.     TDp_print->insert(TILp_dosDevice);
  51.  
  52.  
  53.     //    Make the input line's label.
  54.     TR = TRect(5, 1, 25, 2);
  55.     TLabel *TLp_prompt = new TLabel(TR, "~D~evice to print to",
  56.         TILp_dosDevice);
  57.     TDp_print->insert(TLp_prompt);
  58.  
  59.     //    Make the input line's history.
  60.     TR = TRect(45, 2, 48, 3);
  61.     THistory *THp_printHist = new THistory(TR, TILp_dosDevice,
  62.         usi_PrintHist);
  63.     TDp_print->insert(THp_printHist);
  64.  
  65.     //    Insert the Ok and Cancel buttons.
  66.     auto TButton *TBp_button;
  67.     TR = TRect(9, 4, 21, 6);
  68.     TBp_button = new TButton(TR, "~O~K", cmOK, bfDefault);
  69.     TDp_print->insert(TBp_button);
  70.     TR = TRect(24, 4, 36, 6);
  71.     TBp_button = new TButton(TR, "~C~ancel", cmCancel, bfNormal);
  72.     TDp_print->insert(TBp_button);
  73.  
  74.     //    Stay in the device name field.
  75.     TDp_print->selectNext(False);
  76.  
  77.     //    Draw the dialog.
  78.     TDp_print->drawView();
  79.  
  80.     //    Execute the dialog.
  81.     if(TProgram::deskTop->execView(TDp_print) != cmCancel)    {
  82.         //    User didn't cancel, save what we got as the device
  83.         //    name.
  84.         auto char ca_buffer[usi_TILURLSize];
  85.         TILp_dosDevice->getData(ca_buffer);
  86.         save(ca_buffer, True);
  87.     }
  88.  
  89.     //    Done with dialog.
  90.     destroy(TDp_print);
  91.     return;
  92. }